from django.db import models


class Genre(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=100, unique=False, help_text="Enter a music genre (e.g., Jazz, Rock)")
    href = models.CharField(max_length=255, default="")

    def __str__(self):
        return self.name


class MusicDetail(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255, unique=False, help_text="Enter a music genre (e.g., Jazz, Rock)")
    pic_url = models.CharField(max_length=255, unique=False, default="")
    lrc_path = models.CharField(max_length=255, unique=False, default="")
    author = models.CharField(max_length=255, unique=False, default="")
    audio_path = models.CharField(max_length=255, unique=False, default="")
    audio_url = models.CharField(max_length=255, unique=False, default="")
    genre_id = models.IntegerField()

class MusicCollection(models.Model):
    id = models.AutoField(primary_key=True)
    user_id = models.IntegerField()
    music_id = models.IntegerField()
    collected_on = models.DateTimeField(auto_now_add=True)

class MusicClick(models.Model):
    id = models.AutoField(primary_key=True)
    user_id = models.IntegerField()
    music_id = models.IntegerField()
    click_count = models.IntegerField(default=0)


